﻿namespace OP10.ViewModels
{
    public class ST04WeldParameterViewModel : BindableBase
    {
        private readonly IRegionManager _regionManager;

        public ST04WeldParameterViewModel(IRegionManager regionManager)
        {
            _regionManager = regionManager;

            //开启定时器任务
            DispatcherTimer dispatcherTimer = new DispatcherTimer();
            dispatcherTimer.Interval = TimeSpan.FromMilliseconds(200);
            dispatcherTimer.Tick += OnTick;
            dispatcherTimer.Start();
        }

        private void OnTick(object? sender, EventArgs e)
        {
            Body_AveV= Welder_Global.Body_AveV;
            Body_AveI=Welder_Global.Body_AveI;
            Body_AveW=Welder_Global.Body_AveW;
            Body_R=Welder_Global.Body_R;
            Body_PeakV=Welder_Global.Body_PeakV;
            Body_PeakI=Welder_Global.Body_PeakI;
            Body_PeakW = Welder_Global.Body_PeakW;
            Body_WeldHeigh = Welder_Global.Body_WeldHeigh;
            Body_Pressure=Welder_Global.Body_Pressure;



            Pin_AveV = Welder_Global.Pin_AveV;
            Pin_AveI = Welder_Global.Pin_AveI;
            Pin_AveW = Welder_Global.Pin_AveW;
            Pin_R = Welder_Global.Pin_R;
            Pin_PeakV = Welder_Global.Pin_PeakV;
            Pin_PeakI = Welder_Global.Pin_PeakI;
            Pin_PeakW = Welder_Global.Pin_PeakW;
            Pin_WeldHeigh = Welder_Global.Pin_WeldHeigh;
            Pin_Pressure = Welder_Global.Pin_Pressure;
        }



        #region 事件
        private DelegateCommand _GoBackCommand;

        public DelegateCommand GoBackCommand =>
            _GoBackCommand ?? (_GoBackCommand = new DelegateCommand(ExecuteGoBackCommand));

        void ExecuteGoBackCommand()
        {
            _regionManager.RequestNavigate(PrismManager.MainViewRegionName, AppViews.ST04DeviceManagerView);
        }


        #endregion



        #region 属性
        private float _Body_AveV;
        public float Body_AveV
        {
            get { return _Body_AveV; }
            set { SetProperty(ref _Body_AveV, value); }
        }


        private float _Body_AveI;
        public float Body_AveI
        {
            get { return _Body_AveI; }
            set { SetProperty(ref _Body_AveI, value); }
        }
        private float _Body_AveW;
        public float Body_AveW
        {
            get { return _Body_AveW; }
            set { SetProperty(ref _Body_AveW, value); }
        }


        private float _Body_R;
        public float Body_R
        {
            get { return _Body_R; }
            set { SetProperty(ref _Body_R, value); }
        }


        private float _Body_PeakV;
        public float Body_PeakV
        {
            get { return _Body_PeakV; }
            set { SetProperty(ref _Body_PeakV, value); }
        }
        private float _Body_PeakI;
        public float Body_PeakI
        {
            get { return _Body_PeakI; }
            set { SetProperty(ref _Body_PeakI, value); }
        }
        private float _Body_PeakW;
        public float Body_PeakW
        {
            get { return _Body_PeakW; }
            set { SetProperty(ref _Body_PeakW, value); }
        }
        private int _Body_WeldHeigh;
        public int Body_WeldHeigh
        {
            get { return _Body_WeldHeigh; }
            set { SetProperty(ref _Body_WeldHeigh, value); }
        }

        private float _Body_Pressure;
        public float Body_Pressure
        {
            get { return _Body_Pressure; }
            set { SetProperty(ref _Body_Pressure, value); }
        }



        private float _Pin_AveV;
        public float Pin_AveV
        {
            get { return _Pin_AveV; }
            set { SetProperty(ref _Pin_AveV, value); }
        }


        private float _Pin_AveI;
        public float Pin_AveI
        {
            get { return _Pin_AveI; }
            set { SetProperty(ref _Pin_AveI, value); }
        }
        private float _Pin_AveW;
        public float Pin_AveW
        {
            get { return _Pin_AveW; }
            set { SetProperty(ref _Pin_AveW, value); }
        }


        private float _Pin_R;
        public float Pin_R
        {
            get { return _Pin_R; }
            set { SetProperty(ref _Pin_R, value); }
        }


        private float _Pin_PeakV;
        public float Pin_PeakV
        {
            get { return _Pin_PeakV; }
            set { SetProperty(ref _Pin_PeakV, value); }
        }
        private float _Pin_PeakI;
        public float Pin_PeakI
        {
            get { return _Pin_PeakI; }
            set { SetProperty(ref _Pin_PeakI, value); }
        }
        private float _Pin_PeakW;
        public float Pin_PeakW
        {
            get { return _Pin_PeakW; }
            set { SetProperty(ref _Pin_PeakW, value); }
        }
        private int _Pin_WeldHeigh;
        public int Pin_WeldHeigh
        {
            get { return _Pin_WeldHeigh; }
            set { SetProperty(ref _Pin_WeldHeigh, value); }
        }

        private float _Pin_Pressure;
        public float Pin_Pressure
        {
            get { return _Pin_Pressure; }
            set { SetProperty(ref _Pin_Pressure, value); }
        }
        #endregion
    }
}
